<link rel="stylesheet" href="assets/css/dig-page.css" type="text/css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="assets/css/headline.css" type="text/css" media="screen" title="no title" charset="utf-8">

<?PHP

include 'assets/pages/headline.php'; 

?>
 	
 <div class='c-box' id='dig-polls-box'>
 <h3>Polls</h3>
	<p><?php echo $poll['question']; ?></p>
	<?php 
	
	 foreach($poll_answers as $x)
	 {
	   
		?>
		<li>
		<label>
                        <input type="radio" name="poll" value="<?php echo $x['id']; ?>"  />						
                        <?php echo $x['answer']; ?>
			
        </label>
		</li>
		
		<?php
	 }
	?>
	<span class="vote-nav">
		<?php 
			if($voted || empty($_SESSION['user_level']))
			{
			?>
				<a id="results-button" style="cursor:pointer">See Results</a>
			<?
			}
			else
			{
			?>
				<input type="button" value="vote" id="vote-button" />
			<?php
			}
		?>
		
	
	</span>
	<!--p>Watch this space for fun and exciting weekly polls!</p>-->
  
</div> 	

<div class='c-box-headline c-box-300 ad-med-300-250 c-box-right' id="med-ad" >
  

	<?PHP
	
	global $conf;
	$ad_m = new ads();
	$ad_m->zone=5;
	$ad_m->category=$conf->qm[1];
	$ad_m->serve_image_ad();
	?>
	
</div>
<?PHP

//	include 'assets/pages/dig/dig-main-gallery.php';
//	include 'assets/pages/dig/dig-latest.php';
	

	
	
	include 'assets/pages/dig/dig-main-jocks.php';

	include 'assets/pages/dig/dig-latest.php';
?>
<div id='todayinrock'>
 <span class='dig-trivia'><?php echo $trivia['content']; ?></span>
</div> 
<div class='c-box' id='dig-ekek'>
	<p>
	<span style="float:left;width:50px;">
		<img src="assets/images/dig-quote.png" >
	</span>
		<?PHP 
			$today= date("Y-m-d");
			foreach($ekek as $x){
		
				$date_sub = substr($x['start'],0,10);
				if($today==$date_sub)			
					echo str_replace("\"","",$x['content']); 
			}
		?>

	</p>
</div>  
<div id="popupContact">  
	
        <a id="popupContactClose"><img src='assets/images/x.png'></a>  
	
        <h1><?php echo $poll['question']; ?></h1>  
        <p id="contactArea">  
		<table>
            <?php
			if(empty($poll_answers))
			{
				echo "No one has voted yet";
			}
			else
			{
				$votes = $community->get_poll_results($poll['id']);
				
				foreach($poll_answers as $x)
				{
				echo "<tr>";
				   if(empty($votes[$x['id']]['count(id)']))
					$count = 0;
				   else
					$count = $votes[$x['id']]['count(id)'];
					echo "<td class='label'>".$x['answer']." </td><td>";
						for($i=0;$i<$count;$i++)
						{
							echo "<img height='30px' style='vertical-align:middle' src='assets/images/bar.png'>";
						
						}
					
					echo " $count vote(s) </td>";
					echo "</tr>";
				}
			}
			
		?>
         </table>
		 <?php
		 	if(empty($_SESSION['user_level']))
			{
			?>
				<p>Login to <strong>Pinoytuner</strong> or Connect with us through <strong>facebook</strong> to vote</p>
			<?php
			}
		?>
        </p>  
	
    </div>  
	</section>
	<section class='content body' id='c-box-18-2'>
<?PHP	
	
	
    include 'assets/pages/dig/dig-articles.php';
    
	//include 'assets/pages/dig/dig-gig.php';

    //include 'assets/pages/image-gallery.php';



?>
</section>
<section class='body content' id='c-box-18-3'>
<a href="article/381/watch-anime-night" class='c-box-headline c-box c-box-300 c-box-left adbox1'>
	
</a>
<a href="article/192/watch-brewrats!" class='c-box-headline c-box c-box-300 c-box-left adbox2'>
	
</a>
<a href="article/42/dig-live-from-a-portalette" class='c-box-headline c-box c-box-300 c-box-right adbox3'>
	
</a>
   <?PHP
    
    if($conf->advertise)
    {
            
    
    ?>
    
    <div class='c-box-600 c-box-left c-box-social'>
    <div class='c-box-headline c-box-300 c-box-left c-box-tweet'>
            <script src="http://widgets.twimg.com/j/2/widget.js"></script>
            <script>
            new TWTR.Widget({
              version: 2,
              type: 'profile',
              rpp: 5,
              interval: 4000,
              width: 'auto',
              height: 195,
              theme: {
                shell: {
                  background: '#111',
                  color: '#f2f2f2'
                },
                tweets: {
                  background: '#3F3434',
                  color: '#E4E2D6',
                  links: '#2361A1'
                }
              },
              features: {
                scrollbar: true,
                loop: false,
                live: true,
                hashtags: true,
                timestamp: true,
                avatars: false,
                behavior: 'all'
              }
            }).render().setUser('digradioph').start();
            </script>
    

    </div>
    <div class='c-box-headline c-box-300 c-box-left c-box-fb'>
            <fb:like-box href="http://www.facebook.com/digradio" width="300" height='285' colorscheme="dark" show_faces="true" stream="false" border_color="#ccc" header="true"></fb:like-box>
    

    </div>
    
</div>      
    <?PHP
    
    }
    ?>
	
    <div id="backgroundPopup"></div>
<script type="text/javascript" charset="utf-8">
	$(document).ready(function(){
		
		 var popupStatus = 0;
		 
		 <?php
			if($_GET['voted']==1)
			{?>
				if(popupStatus==0){  
				$("#backgroundPopup").css({  
				"opacity": "0.7"  
				});  
				$("#backgroundPopup").show("slow");  
				$("#popupContact").show("slow");  
				popupStatus = 1;  
		  
				}	  
			<?php
			}
		?>
		//hide inactive tabs		
      		var margintop = 83-$(".dig-trivia p").height()/2;
		$(".dig-trivia p").css("margin-top",margintop);	

		$("#jock-image-<?PHP echo $fjock['id'];?>").show();
		$(".home-jock-image-button").click(function(){
			var name = $(this).attr("id");
			var number= name.replace('jock-image-','');
				$(".home-jock-text").fadeOut(0);
				$("#home-jock-"+number).fadeIn(200);
				
				$(".jock-image").fadeOut(0);
				$("#jock-image-"+number).fadeIn(200);
					
		});
		$(".show-image-button").click(function(){
			var name = $(this).attr("id");
			var number= name.replace('show-image-','');
				$(".show-image-large").fadeOut(0);
				$("#show-image-large-"+number).fadeIn(200);
					
		});


		$("#vote-button").click(function(){
		 if($(":checked").val()==undefined)
		 {
			alert("Please pick your vote");
		 }
		 else
		 {
			var id = <?php echo $_SESSION['user_id'] ?>;
			var vote = $(":checked").val();
			var poll_id = <?php echo $poll['id'] ?>;
			
			$.ajax({
								type: "POST",
								url: "a/process-vote.php",
								data: {'uid':id,'answer_id':vote,'poll_id':poll_id},
								dataType: "json",
								success: function(data) 
								{
									document.location = "community/18?voted=1";
									
								}
				});
		 }
		});
		$("#results-button").click(function(){
			
			//loads popup only if it is disabled  
			if(popupStatus==0){  
			$("#backgroundPopup").css({  
			"opacity": "0.7"  
			});  
			$("#backgroundPopup").show();  
			$("#popupContact").show();  
			popupStatus = 1;  
		  
			}	  
		
		});
		$("#popupContactClose").click(function(){
			if(popupStatus==1){  
				$("#backgroundPopup").hide();  
				$("#popupContact").hide();  
				popupStatus = 0;  
			}  
		});
	});
	
	
	
	
</script>
<script type="text/javascript" charset="utf-8" src="assets/js/headline_control.js"></script>
